<div>
    <el-form    label-width="100%">
        <el-form-item label="">
        </el-form-item>
    </el-form>
    <el-form :inline="true" ref="form" :model="form" label-position="right" label-width="40px">
        <el-form-item label="从"  v-if="$route.params.type!='today'">
            <el-date-picker
                    v-model="form.startDate"
                    type="date"
                    placeholder="开始日期"
                    format="yyyy-MM-dd"
                    @change="pickStartDate"
            >
            </el-date-picker>
        </el-form-item>
        <el-form-item label="到" v-if="$route.params.type!='today'">
            <el-date-picker
                    v-model="form.endDate"
                    type="date"
                    placeholder="结束日期"
                    format="yyyy-MM-dd"
                    @change="pickEndDate"
            >
            </el-date-picker>
        </el-form-item>
        <el-select v-model="form.flightNum" filterable placeholder="航班号" clearable  @change="handleSelect">
            <el-option
                    v-for="plane in planes"
                    :key="plane.flightNum"
                    :label="plane.flightNum"
                    :value="plane"
            >
            </el-option>
        </el-select>
        <el-form-item>
            <el-checkbox v-model="form.scheduled">已排班</el-checkbox>
            <el-checkbox v-model="form.unScheduled">未排班</el-checkbox>
        </el-form-item>
        <el-form-item label=""  class = "transparent">
            <el-button type="primary" @click="queryFlightPlane">查询</el-button>
            <!--<el-button v-if="enterOpen" type="primary"  @click="openEnter(true)">录入</el-button>-->
            <!--<el-button v-if="!enterOpen" type="primary"  @click="openEnter(false)">返回</el-button>-->
        </el-form-item>
    </el-form>
    <kf-table :url="url" :pks="['flightPlaneId']"ref="flightPlane"  stripe >
        <el-table-column prop="flightPlane.flightInfo.flightNum"  label="航班号"  min-width="120">
        </el-table-column>
        <el-table-column  prop="flightPlane.flightInfo.flightType" label="机型" min-width="120" >
        </el-table-column>
        <el-table-column  prop="flightPlane.expectDate" label="预约日期" min-width="100" >
        </el-table-column>
        <el-table-column prop="flightPlane.importOrExport" label="进出港" min-width="100">
        </el-table-column>
        <el-table-column  label="预约航线" min-width="150" >
            <template scope="scope">{{scope.row.flightPlane.originating+"-"+scope.row.flightPlane.destination}}</template>
        </el-table-column>
        <el-table-column prop="flightPlane.planeStatus" label="航班状态" width="100">
        </el-table-column>
        <el-table-column prop="flightPlane.planeStatus" label="是否排班" width="100">
            <template scope="scope">
                <span v-if="scope.row.groundServiceSchedulings">已排班</span>
                <span v-if="!scope.row.groundServiceSchedulings">未排班</span>
            </template>
        </el-table-column>
        <el-table-column prop="flightPlane.takeOffTime" label="预预起飞时间" width="150">
        </el-table-column>
        <el-table-column prop="flightPlane.arriveTime" label="预计到港时间" width="150">
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="200" >
            <template scope="scope" >
                <el-button type="text" @click="edit(scope)" v-if="scope.row.flightPlane.takeOffTime&&scope.row.flightPlane.arriveTime&&!scope.row.groundServiceSchedulings&&!slidingWindowVisible1">一键排班</el-button>
                <el-button type="text" @click="show(scope)" v-if="scope.row.groundServiceSchedulings">详情</el-button>
                <!--<el-button type="text" @click="deletePlanes(scope)" v-if="scope.row.groundServiceSchedulings">微调</el-button>-->
            </template>
        </el-table-column>
    </kf-table>

    <kf-sliding-window :visible.sync="slidingWindowVisible1" :title="'航班'+currentPlane.flightPlane.flightInfo.flightNum+'排班详情'"  close-icon="el-icon-circle-close"  width="800px" v-if="currentPlane.flightPlane">
        <div class="content" style="    display: flex;flex-wrap: wrap;">
            <kf-card  v-if="false" :body-style="{ padding: '0px' } " class="switch-card active"  :width="addScheduling.edit?460:240"  style="height:auto;min-height:180px">
                <div class="switch-card__header" slot="header"  v-if="addScheduling.edit">
                    <div class="switch-card__title">
                        <span class="switch-card__name" v-text="addScheduling.groundServiceItemPo.itemName"></span>
                    </div>
                </div>
                <div  class="switch-card__body"  style="height: 100%" >
                    <div class="card-item" v-if="!addScheduling.edit">
                        <span  @click="startAddScheduling" class=" fa el-icon-plus" style="font-size: 100px"></span>
                    </div>
                    <div class="card-item"  v-if="addScheduling.edit">
                        <el-form ref="addScheduling" :model="addScheduling" label-width="80px">
                            <el-row type="flex"  justify="">
                                <el-form-item label="服务项"  prop="groundServiceItemPoGsiId" :rules
                                        ="[{required:true,message:'服务项不能为空'}]">
                                    <el-select v-model="addScheduling.groundServiceItemPoGsiId" placeholder="请选择进出港" @change="handleSelectItem">
                                        <el-option v-for="item in serviceItems"
                                                   :label="item.itemName"
                                                   :value="item.gsiId"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-row>
                        </el-form>
                    </div>
                </div>
                <div class="switch-card__footer"  slot="footer"  >
                    <el-button type="text" icon="edit"  size="small" v-if="addScheduling.edit" @click="confirmAddSchediling(addScheduling)">保存</el-button>
                    <el-button type="text" icon="close"  size="small" @click="cancleAddScheduling(addScheduling,true)" v-if="addScheduling.edit">取消</el-button>
                </div>
            </kf-card>
            <kf-card v-for="item,index in currentPlane.groundServiceSchedulings.schedulings" :key="item"  class="switch-card active"
                     :width="item.edit?460:240"  style="height:auto;min-height:180px">
                <div class="switch-card__header" slot="header">
                    <div class="switch-card__title">
                        <span class="switch-card__name" v-text="item.groundServiceItemPo.itemName"></span>
                    </div>
                    <!--<div class="switch-card__append" >-->
                        <!--<el-button @click="deleteOneScheduling(item,index)">-->
                            <!--<span ><i class="el-icon-delete"></i></span>-->
                        <!--</el-button>-->
                    <!--</div>-->
                </div>
                <div class="switch-card__body"  style="height: 100%">
                    <div class="card-item" >
                        <h7>已派遣员工：</h7>
                        <template >
                            <div v-for = "user,uIn in item.selectedFwUser" >
                                <el-tag type="success" v-text="user.userCnName"></el-tag>
                            </div>
                        </template>
                    </div>
                </div>
                <!--<div class="switch-card__footer"  slot="footer"  >-->
                    <!--<el-button type="text" icon="edit" @click="editItem(item,index)" size="small" v-if="!item.edit">编辑</el-button>-->
                    <!--<el-button type="text" icon="edit"  size="small" v-if="item.edit" @click="updateSelectdUser(item,index)">保存</el-button>-->
                    <!--&lt;!&ndash;<el-button type="text" icon="close"  size="small" @click="cancleEdit(item,true)" v-if="item.edit">取消</el-button>&ndash;&gt;-->
                <!--</div>-->
            </kf-card>
        </div>
    </kf-sliding-window>
    <el-dialog :title="'配置'+currentService.groundServiceItemPo.itemName+'服务人员'" :visible.sync="dialog"  v-if="currentService.groundServiceItemPo">
        <kf-table-transfer v-model="transferResult" :data="allUser" :titles="['未选用户','可调配人员']" >
            <template slot="left-columns">
                <el-table-column label="用户名" prop="userName" header-align="center"></el-table-column>
                <el-table-column label="中文名" prop="userCnName" header-align="center"></el-table-column>
            </template>
            <template slot="right-columns">
                <el-table-column label="用户名" prop="userName" header-align="center"></el-table-column>
                <el-table-column label="中文名" prop="userCnName" header-align="center"></el-table-column>
            </template>
        </kf-table-transfer>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialog = false">取 消</el-button>
            <el-button type="primary" @click="confirm">确 定</el-button>
            <!--@click="addUserComplate"-->
        </div>
    </el-dialog>

</div>